package com.yty.system.config;

import com.yty.system.entity.SysQuartz;
import com.yty.system.mapper.SysQuartzMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.stereotype.Component;

@Component
public class CronConfig {

    @Autowired
    private SysQuartzMapper sysQuartzMapper;

    @Bean
    public String getCronValue() {
        SysQuartz quartz = sysQuartzMapper.selectById(1);
        if (quartz.getIsOpen() == 1) {
            return quartz.getCronValue();
        }
        System.out.println("执行表达式为：" + quartz.getIsOpen());
        return "-";
    }
}
